#include<stdlib.h>
#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include <fcntl.h>
#include<sys/utsname.h>

int main(int argc,char **argv){

   char hn[1024];
   struct utsname *us;

   gethostname(hn,1024);
   printf(" hostname = %s \n",hn);

   //获取主机信息
   uname(us);
   printf(" machine = %s\n sysname = %s\n nodename = %s\n release = %s\n",us->machine,us->sysname,us->nodename,us->release);
   
   



   return 0;
}